<link href="<?php echo base_url('theme/third_party/rating/demo/css/application.css'); ?>" rel="stylesheet">
<div class="header row">
    <div class="title">
        <input type="hidden" name="default_path" value="<?php echo base_url('theme/third_party/rating/lib/img/'); ?>" />
        <input type="hidden" name="booth_product_id" value="<?php echo $booth_product['id']; ?>" />
        <h1><?php echo $booth['name']; ?></h1>
        <div class=info>
            <b>Địa chỉ:</b> <?php echo $booth['address']; ?> <br/>
            <table>
                <tbody><tr>
                        <td><b>Số điện thoại:</b> <?php echo $booth['tel']; ?></td>
                    </tr><tr>
                        <td><b>Email:</b><a href="mailto:<?php echo $booth['email']; ?>"><?php echo $booth['email']; ?></a></td>
                    </tr></tbody>
            </table>
        </div>
    </div>
    <div class="right-block">
        <table>
            <tbody><tr>
                    <td><b>Ngày đăng tin:</b></td>
                    <td><?php echo date('d/m/Y', strtotime($booth_product['created'])) ?></td>
                </tr><tr>
                    <td><b>Mã ID:</b></td>
                    <td><?php echo str_pad($booth_product['id'], 11, '0', STR_PAD_LEFT) ?></td>
                </tr><tr>
                    <td><b>Lượt xem:</b></td>
                    <td><?php echo $booth_product['viewed']; ?></td>
                </tr><tr>
                    <td><b>Đánh giá:</b></td>
                    <td>
                        <div title="Average rating: <?php echo $booth_product['rate']; ?> stars" id="rate-result" tag="<?php echo $booth_product['rate']; ?>"></div>
                    </td>
                </tr></tbody>
        </table>
    </div>
    <div class="logo">
        <img style="width:100px; height:110px;" class="img-polaroid" src="<?php echo base_url("upload/booth/{$booth['user_id']}/avatar/{$booth['avatar']}"); ?>">
    </div>
</div>
<div class="content row">
    <ul class="list-tab">
        <?php if ($booth_product['name']): ?>
            <li class="list-tab-item list-tab-item-active"><a class="list-tab-item-link" href="#tab-1">Giới thiệu</a></li>
        <?php endif; ?>
        <li class="list-tab-item"><a class="list-tab-item-link" href="#tab-2">Mô tả chi tiết</a></li>
        <li class="list-tab-item"><a class="list-tab-item-link" href="#tab-3">Nhận xét</a></li>
    </ul>
    <div class=block-tab>
        <div id="tab-1" class="block-tab-content intro-tab" style="display: block;">
            <div class=left-column>    
                <?php $albums = explode(';', $booth_product['album']); ?>
                <div id="gallery" class="nivoGallery">
                    <ul>
                        <?php if ($booth_product['intro_video']): ?>
                            <li data-type="video" data-title="YouTube Video"><iframe width="560" height="315" src="<?php echo $booth_product['intro_video']; ?>" frameborder="0" allowfullscreen></iframe></li>
                        <?php endif; ?>
                        <?php foreach ($albums as $album): ?>
                            <?php if (!$album) continue; ?>
                            <li data-title="" data-caption=""><img src="<?php echo base_url("upload/booth/{$booth['user_id']}/products/album/{$booth_product['id']}/{$album}"); ?>" alt="" /></li>
                        <?php endforeach; ?>
                    </ul>
                </div>
            </div>
            <div class=right-column>
                <b style="color: #1C5AC4;"><?php echo $booth_product['name']; ?></b>
                <table>
                    <tbody>
                        <?php if ($booth_product['price']): ?>
                            <tr>
                                <td>Giá bán:</td>
                                <td style="color: #F8A324;font-size: 18px;"><?php echo $booth_product['price']; ?> VNĐ</td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($booth_product['base_price']): ?>
                            <tr>
                                <td>Giá gốc:</td>
                                <td><?php echo $booth_product['base_price']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($booth_product['warranty']): ?>
                            <tr>
                                <td>Bảo hành:</td>
                                <td><?php echo get_warrantys($booth_product['warranty']); ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($booth_product['status']): ?>
                            <tr>
                                <td>Tình trạng:</td>
                                <td><?php echo get_status($booth_product['status']); ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($booth_product['forms']): ?>
                            <tr>
                                <td>Hình thức:</td>
                                <td><?php echo get_forms($booth_product['forms']); ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($booth_product['made_in']): ?>
                            <tr>
                                <td>Xuất xứ:</td>
                                <td><?php echo get_made_in($booth_product['made_in']); ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($booth_product['shipping']): ?>
                            <tr>
                                <td>Vận chuyển:</td>
                                <td><?php echo $booth_product['shipping']; ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if ($booth_product['quantity']): ?>
                            <tr>
                                <td>Số lượng hàng:</td>
                                <td><?php echo $booth_product['quantity']; ?></td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
                <div class="hr"></div>
                <?php echo $booth_product['description']; ?>
            </div>
        </div>

        <div id="tab-2" class="block-tab-content">
            <div class="left-column pull-left" style="width: 48%;">  
                <h4>Thông tin</h4>
                <div class="hr"></div>
                <?php echo $booth_product['product_information']; ?>
            </div>
            <div class="right-column pull-right" style="width: 48%;"> 
                <h4>Mô tả chi tiết</h4>
                <div class="hr"></div>
                <?php echo $booth_product['product_detail']; ?>
            </div> <!-- END .right-column -->         
        </div> <!-- END .tab-1 -->

        <div id="tab-3" class="block-tab-content review-tab">
            <div class=left-column>
                <h4>Xếp hạng của người dùng</h4>
                <?php if (isset($not_login) && $not_login == 1) { ?>
                    <p style="margin: 5px 0 10px 0;color:red;">Bạn cần phải đăng nhập để Xếp hạng của người dùng!</p>
                <?php } else if (isset($rated) && $rated == 1) { ?>
                    <p style="margin: 5px 0 10px 0;">Bạn đã xếp hạng cho sản phẩm này.</p>
                <?php } else { ?>   
                    <div id="rate" tag="<?php echo $booth_product['id']; ?>"></div>
                <?php } ?>    
                <div class="rate-error"></div>
                <h4>Đánh giá của người dùng</h4>
                <?php if (isset($not_login) && $not_login == 1) { ?>
                    <p style="margin: 5px 0 10px 0;color:red;">Bạn cần phải đăng nhập để Đánh giá của người dùng!</p>
                <?php } else { ?>
                    <textarea class="rate-comment" placeholder="Viết bình luận" onkeydown="addComment(event, '<?php echo $booth_product['id']; ?>', '4')"></textarea>
                <?php } ?>
                <div class="rate-comment-error"></div>
            </div>
            <div class=right-column>
                <h4>Đánh giá của người dùng</h4>
                <div class=comment-block>
                    <?php if (isset($check_comment) && $check_comment == 0) { ?>
                        <p style="margin: 5px 0 10px 0;" name="no_comment">Chưa có đánh giá nào cho sản phẩm này.</p>
                    <?php } else { ?>
                        <?php for ($i = 0; $i < count($comment); $i++): ?>
                            <div class=comment-thread>
                                <?php if (isset($comment[$i]['avatar'])) { ?>    
                                    <img src="<?php echo getAvatarLink($comment[$i]['user_id'], $comment[$i]['avatar']); ?> ">
                                <?php } ?>
                                <div class="block-left">
                                    <a class=comment-thread-displayname href="#"><?php echo $comment[$i]['real_name']; ?></a>
                                    <span><?php echo date("Y/m/d H:i:s", strtotime($comment[$i]['commented_time'])); ?></span>
                                    <br />
                                    <div class=comment><?php echo nl2br(htmlspecialchars(urldecode($comment[$i]['comment']))); ?></div>
                                </div>
                            </div>
                        <?php endfor; ?>
                    <?php } ?>
                </div>
            </div>                
        </div>

    </div>
</div>
<div class="footer row">
    <ul class="thumbnails related">
        <?php for ($i = 0; $i < 4; $i++): ?>
            <li>
                <a class="thumbnail" href="#">
                    <div class="content">
                        <div class="title">Lucidchart: Diagramming</div>
                        <div title="Average rating: 4.31 stars (Liked it)">
                            <div class="rsw-starred"></div>
                            <div class="rsw-starred"></div>
                            <div class="rsw-starred"></div>
                            <div class="rsw-starred"></div>
                            <div class="rsw-unstarred"></div>
                        </div>
                    </div>
                    <div class="avatar">
                        <img width=50 height=50 src="https://lh6.googleusercontent.com/Y1m7gRLdYzRGCmQ47GaBsxjbJKSK99-wohDVbmglgB41Hkn1t5QIOuw69hSIRzuwitBtr-5dsg=s50-h50-e365">
                    </div>
                </a>
            </li>
        <?php endfor; ?>
    </ul>
</div>